<template>
  <div class="container">
    <div class="account">
      <xy-acount></xy-acount>
    </div>
    <div
      class="table"
      v-show="false"
    >
      <xy-table
        :api="api"
        :columns="columns"
      >
        <template #addItem>
          <span></span>
        </template>
        <template #operation>
          <span></span>
        </template>
      </xy-table>
    </div>
  </div>
</template>

<script>
import Table from "../table/tableList";
import Acount from "../index/Merchant.vue";
import API from "../../plugins/api";
export default {
  inject: ["toFixed2"],
  components: {
    "xy-table": Table,
    "xy-acount": Acount,
  },
  data() {
    return {
      TotalAccountBalance: 0,
      api: new API("/api/accountInfo/GetList/"),
      columns: {
        MerchantName: "客户名称",
        ServiceName: "服务商名称",
        TotalRechargeAmount: "充值总额",
        AvailableBalance: "可用余额",
        FrozenBalance: "冻结余额",
      },
      addForm: {
        // _serviceproviderid: null,
        ServiceProviderName: "",
        ServiceBank: "",
        // ServiceBankId: null,
        ServiceAccountNo: "",
        PayChannelId: "",

        // MID: "客户",
        CustomerName: "",
        // _agentname: "客户名称",
        ruleType: "",
        RechargeRate: "",
        RechargeTime: "",
        RechargeAmount: "",
        // _rechargetime: "充值时间",
        AccountAmount: "",
        PayingAccountName: "",
        PayingBank: "",
        PayingAccount: "",
        Note: "",
        // RechargeStatus: "充值状态",
      },
    };
  },
  created() {
    this.getTotalAccountBalance();
  },
  methods: {
    async getTotalAccountBalance() {
      let response = await this.$http.get(
        "/api/accountInfo/GetTotalAccountBalance"
      );
      this.TotalAccountBalance = response.data.Data.TotalAccountBalance;
      this.$store.commit("TotalAccountBalance", this.TotalAccountBalance);
    },
    onPay() {
      // this.$router.push("/pay-detail");
      // window.sessionStorage.setItem("recharge", JSON.stringify(this.addForm));
      // this.$router.push({
      //   path: "/detail",
      //   query: {
      //     api: "/api/recharge/Create",
      //   },
      // });
      this.$router.push("pay-detail");
    },
    bulkUndertakes(row) {
      console.log(row);
      this.$router.push("/apply");
    },
  },
};
</script>

<style lang="less" scoped>
.container {
  display: flex;
  flex-direction: column;

  .table {
    flex-basis: 100%;
  }
}
</style>
